<?php

/**
 * This is the model class for table "t_satker".
 *
 * The followings are the available columns in table 't_satker':
 * @property string $KDSATKER
 * @property string $KDINDUK
 * @property string $NMSATKER
 * @property string $KDDEPT
 * @property string $KDUNIT
 * @property string $KDLOKASI
 * @property string $KDKABKOTA
 * @property string $NOMORSP
 * @property string $KDKPPN
 * @property string $KDJNSSAT
 * @property string $KDUPDATE
 * @property string $TGUPDATE
 * @property string $NODSUPDATE
 * @property string $TGDSUPDATE
 * @property string $JNSSEKOLAH
 * @property string $USERID
 * @property string $KDRUH
 * @property string $KDUNIT_AWA
 * @property string $KDPUSDA
 * @property string $KDSATBLU
 * @property string $KDSTATBLU
 * @property string $AMBANGBTS
 * @property string $PERSENPKAI
 * @property string $NOSP_DIPAL
 * @property string $NOSP_BANTU
 * @property string $KDRECEH
 * @property string $KDUNIT2
 * @property string $KDAKTIF
 * @property string $KDAKTIF2
 * @property string $UPDATER
 * @property string $TGLUPDATE
 * @property string $_NullFlags
 */
class TSatker extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return TSatker the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 't_satker';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('KDSATKER, KDINDUK', 'length', 'max'=>6),
			array('NMSATKER', 'length', 'max'=>200),
			array('KDDEPT, KDKPPN, KDUNIT_AWA', 'length', 'max'=>3),
			array('KDUNIT, KDLOKASI, KDKABKOTA, JNSSEKOLAH, KDUNIT2', 'length', 'max'=>2),
			array('NOMORSP, NOSP_DIPAL, NOSP_BANTU', 'length', 'max'=>4),
			array('KDJNSSAT, KDUPDATE, KDRUH, KDPUSDA, KDSATBLU, KDSTATBLU, KDRECEH, KDAKTIF, KDAKTIF2', 'length', 'max'=>1),
			array('NODSUPDATE', 'length', 'max'=>100),
			array('USERID', 'length', 'max'=>9),
			array('UPDATER', 'length', 'max'=>50),
			array('TGUPDATE, TGDSUPDATE, AMBANGBTS, PERSENPKAI, TGLUPDATE, _NullFlags', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('KDSATKER, KDINDUK, NMSATKER, KDDEPT, KDUNIT, KDLOKASI, KDKABKOTA, NOMORSP, KDKPPN, KDJNSSAT, KDUPDATE, TGUPDATE, NODSUPDATE, TGDSUPDATE, JNSSEKOLAH, USERID, KDRUH, KDUNIT_AWA, KDPUSDA, KDSATBLU, KDSTATBLU, AMBANGBTS, PERSENPKAI, NOSP_DIPAL, NOSP_BANTU, KDRECEH, KDUNIT2, KDAKTIF, KDAKTIF2, UPDATER, TGLUPDATE, _NullFlags', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
                    'lokasi' => array(self::BELONGS_TO, 'TLokasi', 'KDLOKASI'),
                    'kabupaten' => array(self::BELONGS_TO, 'TKabkota', 'KDKABKOTA'),
                    'kppn' => array(self::BELONGS_TO, 'TKppn', 'KDKPPN'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'KDSATKER' => 'KD Satker',
			'KDINDUK' => 'Kdinduk',
			'NMSATKER' => 'SATKER',
			'KDDEPT' => 'Kddept',
			'KDUNIT' => 'Kdunit',
			'KDLOKASI' => 'Lokasi',
			'KDKABKOTA' => 'Kab/Kota',
			'NOMORSP' => 'Nomorsp',
			'KDKPPN' => 'KPPN',
			'KDJNSSAT' => 'Kdjnssat',
			'KDUPDATE' => 'Kdupdate',
			'TGUPDATE' => 'Tgupdate',
			'NODSUPDATE' => 'Nodsupdate',
			'TGDSUPDATE' => 'Tgdsupdate',
			'JNSSEKOLAH' => 'Jnssekolah',
			'USERID' => 'Userid',
			'KDRUH' => 'Kdruh',
			'KDUNIT_AWA' => 'Kdunit Awa',
			'KDPUSDA' => 'Kdpusda',
			'KDSATBLU' => 'Kdsatblu',
			'KDSTATBLU' => 'Kdstatblu',
			'AMBANGBTS' => 'Ambangbts',
			'PERSENPKAI' => 'Persenpkai',
			'NOSP_DIPAL' => 'Nosp Dipal',
			'NOSP_BANTU' => 'Nosp Bantu',
			'KDRECEH' => 'Kdreceh',
			'KDUNIT2' => 'Kdunit2',
			'KDAKTIF' => 'Kdaktif',
			'KDAKTIF2' => 'Kdaktif2',
			'UPDATER' => 'Updater',
			'TGLUPDATE' => 'Tglupdate',
			'_NullFlags' => 'Null Flags',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('KDSATKER',$this->KDSATKER,true);
		$criteria->compare('KDINDUK',$this->KDINDUK,true);
		$criteria->compare('NMSATKER',$this->NMSATKER,true);
		$criteria->compare('KDDEPT',$this->KDDEPT,true);
		$criteria->compare('KDUNIT',$this->KDUNIT,true);
		$criteria->compare('KDLOKASI',$this->KDLOKASI,true);
		$criteria->compare('KDKABKOTA',$this->KDKABKOTA,true);
		$criteria->compare('NOMORSP',$this->NOMORSP,true);
		$criteria->compare('KDKPPN',$this->KDKPPN,true);
		$criteria->compare('KDJNSSAT',$this->KDJNSSAT,true);
		$criteria->compare('KDUPDATE',$this->KDUPDATE,true);
		$criteria->compare('TGUPDATE',$this->TGUPDATE,true);
		$criteria->compare('NODSUPDATE',$this->NODSUPDATE,true);
		$criteria->compare('TGDSUPDATE',$this->TGDSUPDATE,true);
		$criteria->compare('JNSSEKOLAH',$this->JNSSEKOLAH,true);
		$criteria->compare('USERID',$this->USERID,true);
		$criteria->compare('KDRUH',$this->KDRUH,true);
		$criteria->compare('KDUNIT_AWA',$this->KDUNIT_AWA,true);
		$criteria->compare('KDPUSDA',$this->KDPUSDA,true);
		$criteria->compare('KDSATBLU',$this->KDSATBLU,true);
		$criteria->compare('KDSTATBLU',$this->KDSTATBLU,true);
		$criteria->compare('AMBANGBTS',$this->AMBANGBTS,true);
		$criteria->compare('PERSENPKAI',$this->PERSENPKAI,true);
		$criteria->compare('NOSP_DIPAL',$this->NOSP_DIPAL,true);
		$criteria->compare('NOSP_BANTU',$this->NOSP_BANTU,true);
		$criteria->compare('KDRECEH',$this->KDRECEH,true);
		$criteria->compare('KDUNIT2',$this->KDUNIT2,true);
		$criteria->compare('KDAKTIF',$this->KDAKTIF,true);
		$criteria->compare('KDAKTIF2',$this->KDAKTIF2,true);
		$criteria->compare('UPDATER',$this->UPDATER,true);
		$criteria->compare('TGLUPDATE',$this->TGLUPDATE,true);
		$criteria->compare('_NullFlags',$this->_NullFlags,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}